package com.atstudy.headline.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.util.Date;

/**
 * 用户行为分类统计表
 * @TableName user_behavior_category_stats
 */
@TableName(value ="user_behavior_category_stats")
@Data
public class UserBehaviorCategoryStats {
    /**
     * ID
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 统计日期
     */
    private Date statDate;

    /**
     * 用户ID(为NULL表示所有用户)
     */
    private Integer userId;

    /**
     * 分类ID(为NULL表示所有分类)
     */
    private Integer categoryId;

    /**
     * 行为类型
     */
    private String behaviorType;

    /**
     * 行为类型编码
     */
    private Integer behaviorCode;

    /**
     * 行为次数
     */
    private Integer count;

    /**
     * 创建时间
     */
    private Date createTime;

    @TableField(exist = false)
    private String username;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserBehaviorCategoryStats other = (UserBehaviorCategoryStats) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getStatDate() == null ? other.getStatDate() == null : this.getStatDate().equals(other.getStatDate()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getBehaviorType() == null ? other.getBehaviorType() == null : this.getBehaviorType().equals(other.getBehaviorType()))
            && (this.getBehaviorCode() == null ? other.getBehaviorCode() == null : this.getBehaviorCode().equals(other.getBehaviorCode()))
            && (this.getCount() == null ? other.getCount() == null : this.getCount().equals(other.getCount()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getStatDate() == null) ? 0 : getStatDate().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getBehaviorType() == null) ? 0 : getBehaviorType().hashCode());
        result = prime * result + ((getBehaviorCode() == null) ? 0 : getBehaviorCode().hashCode());
        result = prime * result + ((getCount() == null) ? 0 : getCount().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", statDate=").append(statDate);
        sb.append(", userId=").append(userId);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", behaviorType=").append(behaviorType);
        sb.append(", behaviorCode=").append(behaviorCode);
        sb.append(", count=").append(count);
        sb.append(", createTime=").append(createTime);
        sb.append("]");
        return sb.toString();
    }
}
